package com.wuyou.designPatterns.prototype;

import com.wuyou.designPatterns.prototype.framework.Manager;
import com.wuyou.designPatterns.prototype.framework.Product;

public class PrototypeMain {

    public static void main(String[] args) throws CloneNotSupportedException {
        Product mb = new MessageBox('`');
        Object o = new Object();
        Product up = new UnderlinePen('~');
        up.use("李琳");
        Manager manager = new Manager();
        manager.register("mb", mb);
        manager.register("up", up);

        Product mb1 = manager.create("mb");
        mb1.use("张宇航");
        Product up1 = manager.create("up");
        up1.use("李琳");

        System.out.println(mb.createClone().equals(mb));
        System.out.println(mb.createClone() == mb);
        System.out.println(mb.createClone().getClass() == mb.getClass());

        SuperMessageBox superMessageBox = new SuperMessageBox('2');
        System.out.println(superMessageBox.clone().equals(superMessageBox));
        System.out.println(superMessageBox.clone() == superMessageBox);
        System.out.println(superMessageBox.clone().getClass() == superMessageBox.getClass());
    }
}
